<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改密码</title>
    <style>
        /* 全局样式 */
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f0f2f5;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        /* 容器样式 */
        .change-password-container {
            background-color: #ffffff;
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            width: 350px;
            text-align: center;
        }

        .change-password-container h2 {
            font-size: 24px;
            font-weight: 600;
            color: #333;
            margin-bottom: 20px;
        }

        /* 输入框样式 */
        .input-group {
            margin-bottom: 20px;
            text-align: left;
        }

        .input-group label {
            display: block;
            font-size: 14px;
            font-weight: 500;
            color: #555;
            margin-bottom: 5px;
        }

        .input-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.3s ease;
        }

        .input-group input:focus {
            border-color: #007bff;
            outline: none;
        }

        /* 提交按钮样式 */
        .submit-button {
            width: 100%;
            padding: 12px;
            border: none;
            border-radius: 8px;
            background-color: #007bff;
            color: #fff;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        .submit-button:hover {
            background-color: #0056b3;
        }

        /* 返回按钮样式 */
        .back-button {
            display: block;
            width: 100%;
            padding: 12px;
            margin-top: 10px;
            border: none;
            border-radius: 8px;
            background-color: #6c757d;
            color: #fff;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.3s ease;
            text-align: center;
            text-decoration: none;
        }

        .back-button:hover {
            background-color: #5a6268;
        }
    </style>
</head>
<body>

<!-- 修改密码容器 -->
<div class="change-password-container">
    <h2>修改密码</h2>

    <!-- 用户名输入 -->
    <div class="input-group">
        <label for="username">用户名</label>
        <input type="text" id="username" placeholder="请输入用户名">
    </div>

    <!-- 原密码输入 -->
    <div class="input-group">
        <label for="old-password">原密码</label>
        <input type="password" id="old-password" placeholder="请输入原密码">
    </div>

    <!-- 新密码输入 -->
    <div class="input-group">
        <label for="new-password">新密码</label>
        <input type="password" id="new-password" placeholder="请输入新密码">
    </div>

    <!-- 确认新密码输入 -->
    <div class="input-group">
        <label for="confirm-password">确认新密码</label>
        <input type="password" id="confirm-password" placeholder="请再次输入新密码">
    </div>

    <!-- 提交按钮 -->
    <button class="submit-button" onclick="changePassword()">提交</button>

    <!-- 返回按钮 -->
    <a href="user.html" class="back-button">返回</a>
</div>

<script>
    function changePassword() {
        const username = document.getElementById('username').value;
        const oldPassword = document.getElementById('old-password').value;
        const newPassword = document.getElementById('new-password').value;
        const confirmPassword = document.getElementById('confirm-password').value;

        // 简单的验证逻辑
        if (!username || !oldPassword || !newPassword || !confirmPassword) {
            alert('请填写所有字段');
            return;
        }

        if (newPassword !== confirmPassword) {
            alert('新密码和确认密码不一致');
            return;
        }

        // 这里可以添加实际的密码修改逻辑，例如调用API
        alert('密码修改成功！');
        window.location.href = 'profile.html'; // 修改成功后跳转到个人信息页面
    }
</script>

</body>
</html>